﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace voicedMelody.FeatureExtraction
{
    public class Feature : ICloneable
    {
        public double[] PowerSpectrum { get; set; }

        public double[] MFCC { get; set; }

        //Class Information

        public double[] ClassInfo { get; set; }

        public string Instrument { get; set; }

        public string Note { get; set; }

        public int ZCR { get; set; }

        public object Clone()
        {
            Feature feature = new Feature();

            if (this.MFCC != null)
            {
                feature.MFCC = new double[this.MFCC.Length];
                Array.Copy(this.MFCC, feature.MFCC, this.MFCC.Length);
            }

            if (this.PowerSpectrum != null)
            {
                feature.PowerSpectrum = new double[this.PowerSpectrum.Length];
                Array.Copy(this.PowerSpectrum, feature.PowerSpectrum, this.PowerSpectrum.Length);
            }

            if (this.ClassInfo != null)
            {
                feature.ClassInfo = new double[this.ClassInfo.Length];
                Array.Copy(this.ClassInfo, feature.ClassInfo, this.ClassInfo.Length);
            }

            feature.Instrument = this.Instrument;
            feature.Note = this.Note;

            return feature;
        }
    }
}
